package com.woniuxy.aimcpserver.tools;

import com.woniuxy.aimcpserver.entity.Doctor;
import com.woniuxy.aimcpserver.entity.Schedule;
import com.woniuxy.aimcpserver.entity.food;
import com.woniuxy.aimcpserver.mapper.DoctorMapper;
import com.woniuxy.aimcpserver.mapper.ScheduleMapper;
import org.springframework.ai.tool.annotation.Tool;
import org.springframework.ai.tool.annotation.ToolParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Date;
import java.util.List;

@Service
public class DoctorService {
    @Autowired
    DoctorMapper doctorMapper;
    @Autowired
    ScheduleMapper scheduleMapper;
    @Tool(description = "获取所有医生信息", name = "doctorQuery")
    public List<Doctor> getDoctor() {
        System.out.println( doctorMapper.findAllDoctors()+"----");
        return doctorMapper.findAllDoctors();
    }



    @Tool(description = "查询排班信息", name = "findDtor")
    public List<Schedule>  findDoctor(@ToolParam(description = "医生名字")String doctorName) {
        List<Schedule> schedules = scheduleMapper.findSchedulesByConditions(doctorName,
                null,
                null);
        return schedules;
    }
    @Tool(description = "查询指定日期的挂号信息", name = "findDoctorByDe")
    public List<Schedule>  findDoctorByDate(
                                      @ToolParam(description = "日期")String date) {
        List<Schedule> schedules = scheduleMapper.findSchedulesByConditions(null,
                Date.valueOf(date),
                null);
        return schedules;
    }
}
